ubg_health_create_icon

Syntax:

ubg_health_create_icon(layer, sprite, x, y, health_min, health_max, columns, padding, event)

Arguments:

Argument Name Type Description
layerlayer_idid or name of the layer to create the healthbar on
spritespriteid of the sprite to use as the health icon
xrealx-position to create the healthbar at
yrealy-position to create the healthbar at
health_minrealminimum value that the health can be
health_maxrealmaximum value that the health can be
columnsrealnumber of columns to allow (-1 = unlimited)
paddingrealpadding, in pixels, between each icon
eventUBG_HEALTH_RENDER_EVENTenum value from UBG_HEALTH_RENDER_EVENT specifying to render in draw or gui

Returns: (real)

Description:

This function creates a new healthbar with the visual appearance of individual icons where one icon represents one health unit.

Icons can be limited to the number of columns and they can be animated as well when gaining / losing health. If an animated image is provided the first frame will be the visual when the health unit is full. The last frame will be the visual when the health unit is empty.

An simple example would be something like this:

healthbar_icon = ubg_health_create_icon("Instances", ubg_health_heart_fade_spr, 10, 10, 0, 10, -1, 0, UBG_HEALTH_RENDER_EVENT.draw_gui);

The available render events are as follows:

The coordinates you provide this functtion are dependent on which draw event you choose! Using the *draw_normal* mode will render in room coordinates while using *draw_gui* will render in screen coordinates!

Back: System
Next: ubg_health_create_bar